package com.suixinsanren.design.factory.demo.demo02;

import java.util.ArrayList;
import java.util.List;

public abstract class Pizza {

    protected String name;
    protected String dough;
    protected String sauce;
    protected List<String> toppings = new ArrayList<>();

    public void prepare() {
        System.out.println("准备： " + name);
        System.out.println("扔面团...");
        System.out.println("加酱汁...");
        System.out.println("添加配料：");
        for (String topping : toppings) {
            System.out.println("   " + topping);
        }
    }

    public void bake() {
        System.out.println("350℃烘焙25分钟");
    }

    public void cut() {
        System.out.println("把披萨切成对角线的薄片");
    }

    public void box() {
        System.out.println("将披萨放入披萨官方包装盒");
    }

    public String getName() {
        return name;
    }

    @Override
    public String toString() {
        StringBuilder display = new StringBuilder();
        display.append("---- ").append(name).append(" ----\n");
        display.append(dough).append("\n");
        display.append(sauce).append("\n");
        for (String topping : toppings) {
            display.append(topping).append("\n");
        }
        return display.toString();
    }
}
